package com.supinfo.food.services;


import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import com.supinfo.food.dao.DaoFactory;
import com.supinfo.food.dao.ThemeDao;
import com.supinfo.food.entities.Theme;

/**
 * Theme service
 * @author Nico
 */
@WebService(name="Theme", serviceName="Theme")
public class ThemeService {

	private ThemeDao dao = DaoFactory.getThemeDao();
	
	@WebMethod(operationName="addTheme")
	public Theme addTheme(@WebParam(name="theme") Theme theme) {
		return dao.addTheme(theme);
	}

	/**
	 * @param theme
	 * @return
	 */
	@WebMethod(operationName="updateTheme")
	public Theme updateTheme(@WebParam(name="theme") Theme theme) {
		return dao.updateTheme(theme);
	}
	
	/**
	 * Get the current theme
	 * @return
	 */
	@WebMethod(operationName="getCurrentTheme")
	public Theme getCurrentTheme() {
		return null;//dao.getCurrentTheme();
	}
	
	/**
	 * Get a theme with an id in parameter
	 * @param id
	 * @return
	 */
	@WebMethod(operationName="getThemeById")
	public Theme getThemeById(@WebParam(name="id") Long id) {
		return dao.findTheme(id);
	}

	/**
	 * Delete a theme to DB
	 * @param theme
	 */
	@WebMethod(operationName="removeTheme")
	public void removeTheme(@WebParam(name="theme") Theme theme) {
		dao.removeTheme(theme);
	}
	
}
